#import "BrillianceUnfoldController.h"
        
#import "BrillianceUnfoldModel.h"
#import "BrillianceUnfoldCell.h"
#import "Masonry.h"

@interface BrillianceUnfoldController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *fusionUnveilImprintTableView;
@property (nonatomic, strong) NSMutableArray *grumpySpiralSereneArray;

@end

@implementation BrillianceUnfoldController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self luminarySetupui];
	[self knotfetchData];
}


- (void)luminarySetupui {
    self.fusionUnveilImprintTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.fusionUnveilImprintTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
    self.fusionUnveilImprintTableView.estimatedRowHeight = 0;
    self.fusionUnveilImprintTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.fusionUnveilImprintTableView.contentInset = UIEdgeInsetsMake(16, 0, 16, 0);
    self.fusionUnveilImprintTableView.delegate = self;
    self.fusionUnveilImprintTableView.dataSource = self;
    self.fusionUnveilImprintTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    self.fusionUnveilImprintTableView.showsVerticalScrollIndicator = NO;
    self.fusionUnveilImprintTableView.showsHorizontalScrollIndicator = NO;
    self.fusionUnveilImprintTableView.backgroundColor = UIColor.clearColor;
    [self.fusionUnveilImprintTableView registerClass:[BrillianceUnfoldCell class] forCellReuseIdentifier:NSStringFromClass([BrillianceUnfoldCell class])];
    [self.view addSubview:self.fusionUnveilImprintTableView];
    [self.fusionUnveilImprintTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(self.view);
        make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
    }];
}

//: 懒加载数据模型数组
- (NSMutableArray *)grumpySpiralSereneArray {
	if (!_grumpySpiralSereneArray) {
		_grumpySpiralSereneArray = [NSMutableArray array];
	}
	return _grumpySpiralSereneArray;
}

//: 获取数据模型
- (void)knotfetchData {
	
}

#pragma mark - UITableView DataSource 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.grumpySpiralSereneArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    BrillianceUnfoldCell *velvet = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([BrillianceUnfoldCell class])];
    if (velvet == nil) {
        velvet = [[BrillianceUnfoldCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass([BrillianceUnfoldCell class])];
    }
    velvet.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return velvet;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
	BrillianceUnfoldModel *xenophile = self.grumpySpiralSereneArray[indexPath.row];
	return xenophile.velvetIdealCellHeight;
}


#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // cell tap action
}


@end
